# -*- coding: utf-8 -*-
"""
# @Time    : 2021/1/11 下午5:50
# @Author  : tgy
"""

"""
对象隐藏属性是在类执行的时候替换的名称，所以在对象创建之后在进行对象属性赋值时，则无法进行属性隐藏
"""


class PersonInfo:
    __name = ''
    print('1111')

    def __init__(self, name):
        self.__name = name

    def __f1(self):
        print('111')

    def set__name(self, name):
        if not isinstance(name, str):
            raise TypeError('name 参数类型错误')
        self.__name = name


if __name__ == '__main__':
    ...
    print('222')
    person_info = PersonInfo('zhangsan')
    person_info.set__name('11')
    person_info.__opt = '11'
    print(person_info.__dict__)
